import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_study_app/widget/grid_select_button_view.dart';
import 'package:flutter_study_app/widget/my_app_bar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ReturnVisitRecordPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _ReturnVisitRecordPageState();
}

class _ReturnVisitRecordPageState extends State<ReturnVisitRecordPage> {
  List<String> _selectItems = ['商户巡检', '培训', '机具安装维修', '更新程序', '其他服务'];
  List<String> _radioItems = ['正常', '异常'];
  List<String> _suggestItems = ['正常维护', '加强关注', '建议停用', '撤机销户'];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        title: '回访培训记录',
      ),
      body: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              child: Column(
                children: [
                  Container(
                    padding: EdgeInsets.all(12.w),
                    color: Colors.white,
                    child: Container(
                      padding: EdgeInsets.only(
                          left: 14.w, right: 14.w, top: 16.w, bottom: 16.w),
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(8.w),
                          color: Color(0xFFE1F4EE)),
                      height: 115.w,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '商户的名字内容',
                            textAlign: TextAlign.left,
                            style: TextStyle(
                                color: Color(0xFF104B42), fontSize: 18.sp),
                          ),
                          SizedBox(
                            height: 12.w,
                          ),
                          Row(
                            children: [
                              Image.asset(
                                'assets/images/ic_id.png',
                                width: 16.w,
                                height: 16.w,
                              ),
                              SizedBox(
                                width: 5.w,
                              ),
                              Text(
                                '编号12344566',
                                style: TextStyle(
                                  color: Color(0xFF104B42),
                                ),
                              ),
                            ],
                          ),
                          SizedBox(
                            height: 4.w,
                          ),
                          Row(
                            children: [
                              Image.asset(
                                'assets/images/ic_address_green.png',
                                width: 16.w,
                                height: 16.w,
                              ),
                              SizedBox(
                                width: 5.w,
                              ),
                              Expanded(
                                child: Text(
                                  '湖南省株洲市茶陵县上合村村口村口村口村1231231231312312312321312eqweqweqweqweqw',
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: TextStyle(
                                      color: Color(0xFF104B42),
                                      fontSize: 14.sp),
                                ),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '服务类型（可多选）',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 12.w, right: 12.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 3,
                    itemCount: 5,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    valueList: _selectItems,
                    getItemText: (index) => _selectItems[index],
                    isSingleSelect: false,
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '商户经营情况',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                        left: 12.w,
                        right: 12.w,
                        top: 16.w,
                      ),
                      child: Row(
                        children: [
                          Text(
                            '1、',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                          Text(
                            '商户经营情况是否正常？',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                        ],
                      )),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 2,
                    itemCount: 2,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    getItemText: (index) => _radioItems[index],
                    valueList: _radioItems,
                  ),
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                        left: 12.w,
                        right: 12.w,
                        top: 16.w,
                      ),
                      child: Row(
                        children: [
                          Text(
                            '2、',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                          Text(
                            '商户法人及联系方式是否变更？',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                        ],
                      )),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 2,
                    itemCount: 2,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    getItemText: (index) => _radioItems[index],
                    valueList: _radioItems,
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '设备运行及风险情况',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                        left: 12.w,
                        right: 12.w,
                        top: 16.w,
                      ),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '1、',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                          Expanded(
                            child: Text(
                              '客户交易结算资金是否与其经营情况相符，是否存在套现、虚假交易或其他可疑交易行为？',
                              maxLines: 2,
                              style: TextStyle(
                                  fontSize: 14.sp, color: Color(0xFF333333)),
                            ),
                          ),
                        ],
                      )),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 2,
                    itemCount: 2,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    getItemText: (index) => _radioItems[index],
                    valueList: _radioItems,
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '商户培训情况',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                        left: 12.w,
                        right: 12.w,
                        top: 16.w,
                      ),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '1、',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                          Expanded(
                            child: Text(
                              '收银员是否掌握收单受理操作？',
                              maxLines: 2,
                              style: TextStyle(
                                  fontSize: 14.sp, color: Color(0xFF333333)),
                            ),
                          ),
                        ],
                      )),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 2,
                    itemCount: 2,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    getItemText: (index) => _radioItems[index],
                    valueList: _radioItems,
                  ),
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                        left: 12.w,
                        right: 12.w,
                        top: 16.w,
                      ),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '2、',
                            style: TextStyle(
                                fontSize: 14.sp, color: Color(0xFF333333)),
                          ),
                          Expanded(
                            child: Text(
                              '培训内容',
                              maxLines: 2,
                              style: TextStyle(
                                  fontSize: 14.sp, color: Color(0xFF333333)),
                            ),
                          ),
                        ],
                      )),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(16.w),
                    child: TextField(
                      scrollPadding: EdgeInsets.zero,
                      textAlign: TextAlign.start,
                      maxLines: 2,
                      decoration: InputDecoration(
                        isDense: true,
                        contentPadding: EdgeInsets.all(10.w),
                        hintText: '请输入培训内容',
                        hintStyle: TextStyle(
                            fontSize: 14.sp, color: Color(0xFF999999)),
                        labelStyle: TextStyle(
                            fontSize: 14.sp, color: Color(0xFF333333)),
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(4.w),
                          borderSide:
                              BorderSide(width: 1.w, color: Color(0xFFD8D8D8)),
                        ),
                        focusedBorder: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(4.w),
                            borderSide: BorderSide(
                                width: 1.w, color: Color(0xFF009669))),
                        enabledBorder: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(4.w),
                          borderSide:
                              BorderSide(width: 1.w, color: Color(0xFFD8D8D8)),
                        ),
                      ),
                    ),
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '回访结论',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(16.w),
                    child: TextField(
                      scrollPadding: EdgeInsets.zero,
                      textAlign: TextAlign.start,
                      maxLines: 2,
                      decoration: InputDecoration(
                        isDense: true,
                        contentPadding: EdgeInsets.all(10.w),
                        hintText: '请输入回访结论',
                        hintStyle: TextStyle(
                            fontSize: 14.sp, color: Color(0xFF999999)),
                        labelStyle: TextStyle(
                            fontSize: 14.sp, color: Color(0xFF333333)),
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(4.w),
                          borderSide:
                              BorderSide(width: 1.w, color: Color(0xFFD8D8D8)),
                        ),
                        focusedBorder: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(4.w),
                            borderSide: BorderSide(
                                width: 1.w, color: Color(0xFF009669))),
                      ),
                    ),
                  ),
                  Container(
                    height: 12.w,
                    color: Color(0xFFF5F4F3),
                  ),
                  Container(
                    color: Colors.white,
                    padding: EdgeInsets.all(
                      12.w,
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 3.w,
                          height: 14.w,
                          decoration: BoxDecoration(
                            color: Color(0xFF009669),
                            borderRadius: BorderRadius.circular(2.w),
                          ),
                        ),
                        SizedBox(
                          width: 16.w,
                        ),
                        Text(
                          '后续建议',
                          style: TextStyle(
                              color: Color(0xFF333333), fontSize: 16.sp),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1.w,
                    color: Color(0xFFF5F4F3),
                    margin: EdgeInsets.only(left: 12.w, right: 12.w),
                  ),
                  GridSelectButtonView(
                    padding: EdgeInsets.only(
                        left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
                    crossAxisCount: 2,
                    itemCount: _suggestItems.length,
                    fixedHeight: 36.w,
                    mainAxisSpacing: 12.w,
                    crossAxisSpacing: 12.w,
                    getItemText: (index) => _suggestItems[index],
                    valueList: _suggestItems,
                  ),
                  Container(
                    height: 21.w,
                    color: Color(0xFFF5F4F3),
                  ),
                ],
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.all(15.w),
            color: Colors.white,
            child: InkWell(
              onTap: () {},
              child: Row(
                children: [
                  Image.asset(
                    'assets/images/ic_check_no.png',
                    width: 20.w,
                    height: 20.w,
                  ),
                  SizedBox(
                    width: 8.w,
                  ),
                  Text(
                    '商户本人已知晓上述全部内容',
                    style: TextStyle(color: Color(0xFF333333), fontSize: 14.sp),
                  )
                ],
              ),
            ),
          ),
          Container(
            height: 1.w,
            color: Color(0xFFF5F4F3),
          ),
          SafeArea(
            child: Container(
              padding: EdgeInsets.all(12.w),
              width: double.infinity,
              height: 74.w,
              color: Colors.white,
              child: TextButton(
                style: ButtonStyle(
                  backgroundColor: MaterialStateProperty.all(Color(0xff009868)),
                ),
                onPressed: () {},
                child: Text(
                  '提交',
                  style: TextStyle(color: Colors.white, fontSize: 18.sp),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
